<template>
  <div>
    <!-- type : 1专利 2商标 3版权 ，显示 temp页面；8专利 9商标 10版权，隐藏 temp页面-->

    <template v-if="$app.judgeData(type) && type!=9 && type!=8 && type!=10">
      <!-- <Card :style="`height:${$app.winHeight-145}px;overflow:auto;${wonR()}`"> -->
      <Card :style="`min-height:${$app.winHeight-145}px;`">
        <template v-if="type==1">
          <div class="tempUl margin0">
            <div v-for="(val,i) in list" :key="'a'+i" :class="i!=(list.length-1)?' marginB30 ' :' '">
              <div class="f_18 padding10 cBlue titleD">
                <div class="ui-bT relative">
                  <i class="iconfont f_24 relative inlineBlock" :class="iconWw(i)"></i>
                  {{val.group}}
                </div>
                <div class="f_14 cRed " style="padding:0 0 0 36px">
                  <template v-if="$app.judgeData(val.tip)">
                    {{val.tip}}
                  </template>
                </div>
              </div>
              <ul>
                <li
                  v-for="(val,i) in val.items"
                  :key="'b'+i"
                  class="textLink"
                  @click="away(val.goods_type,val.title)"
                  v-show="!val.is_hide"
                >{{val.title}}</li>
              </ul>
            </div>
          </div>
        </template>
        <template v-else-if="type==2">
          <div class="f_24 c333" style="margin:20px 0 20px 0;">
            <div class="marginB10">商标服务</div>
          </div>

          <div class="tempUl" v-for="(val,i) in list" :key="'c'+i">
            <div class="f_18 padding10 cBlue titleD">
              <div class="ui-bT relative">
                <i class="iconfont f_24 relative inlineBlock" :class="iconR(i)"></i>
                {{val.group}}
              </div>
            </div>
            <ul>
              <li
                v-for="(val,i) in val.items"
                :key="'f'+i"
                class="textLink"
                v-show="!val.is_hide"
                @click="away(val.goods_type,val.title)"
              >{{val.title}}</li>
            </ul>
          </div>
        </template>

        <template v-else-if="type==3">
          <div class="f_24 c333" style="margin:20px 0 30px 0;">
            <div class="marginB10">版权服务</div>
            <div class="cRed marginB10 f_14">提示：版权业务下单后，待系统审核通过需快递纸质原件</div>
          </div>

          <div class="tempUl" v-for="(val,i) in list" :key="'e'+i">
            <div class="f_18 padding10 cBlue titleD">
              <div class="ui-bT relative">
                <i class="iconfont f_24 relative inlineBlock" :class="iconWv(i)"></i>
                {{val.group}}
              </div>
            </div>
            <ul>
              <li
                v-for="(val,i) in val.items"
                :key="'f'+i"
                class="textLink"
                v-show="!val.is_hide"
                @click="away(val.goods_type,val.title)"
              >{{val.title}}</li>
            </ul>
          </div>
        </template>
      </Card>

      <!-- 右上角剩余金额的弹框 -->
      <div
        class="rMoneyBox padding10"
        :style="`width:${suoJ?'200px':'50px'}; height:${suoJ?'auto':'50px'}; top:118px; right:18px;` "
      >
        <div v-show="suoJ">
          <div class="paddingLR15 c999">
            <div class="f_16 marginB10 f_bold">当前余额</div>
            <div class="f_14 marginB5">
              总余额：¥
              <span
                class="f_18 cBlue f_bold"
              >{{$app.judgeData(companyAll)?parseFloat(companyAll.balance):0}}</span>
            </div>
            <div class="f_14">
              猫币：¥
              <span
                class="f_18 cBlue f_bold"
              >{{$app.judgeData(companyAll)?parseFloat(companyAll.currency):0}}</span>
            </div>
          </div>
        </div>
        <Icon
          :type="`${suoJ?'ios-arrow-dropright':'ios-arrow-dropleft-circle'}`"
          size="28"
          class="pointer suoJ"
          :class="`${suoJ?' cCCC':' cBlue'}`"
          @click="suoJ=!suoJ"
          style="top:10px;"
        />
      </div>
    </template>

    <!-- 没有流程 的弹框处理 -->
    <Modal
      v-model="cHBox"
      :footer-hide="true"
      :mask-closable="false"
      width="720"
      @on-visible-change="vPchange"
      class-name="vertical-center-modal"
    >
      <div class="f_24 c333 marginB20">{{boxObj.title}}</div>
      <!-- type：1专利提交流程；8专利展示详情 -->
      <template v-if="type==1 || type==8">
        <!-- 117 是 补差价 -->
        <template v-if="boxObj.zhongObj.goods_type!=117">
          <!-- 第2排type 103 104 105，第4排数据type 106 107 108，第3排数据type 130 131 132 -->
          <template v-if="$app.is103_108_132(boxObj.type)">
            <Row :gutter="15" class="f_14 marginB15">
              <Col :span="6" class="textRight c999 lineH34">
                <span class="cRed">*</span>
                专利名称：
              </Col>
              <Col :span="15">
                <Input
                  class="tempFW"
                  :placeholder="$app.judgeData(order_id)?'':'请输入专利名称'"
                  size="large"
                  v-model="patent_name"
                  ref="patent_nameXx"
                  clearable
                  :disabled="$app.judgeData(order_id)"
                  maxlength="50"
                />
                <div class="padding5 cCCC ">字数限制：{{ziShuJ()}}/50</div>

              </Col>
            </Row>

            <!-- 文件上传框 有材料专用 -->
            <Row :gutter="15" class="f_14 marginB15" v-show="boxObj.showZipBox">
              <Col :span="6" class="textRight c999 ">
                <!-- 外观专利 -->
                <span class="cRed" v-show="wg104_107()">*</span>
                材料类型：
              </Col>
              <Col :span="15">
                <div class="marginB10"  v-show="!wg104_107()">
                  <RadioGroup v-model="boxObj.youWj" size="large" class="" @on-change="youWj_Fun" >
                    <Radio :label="1" class="marginR20">有材料</Radio>
                    <Radio :label="0">无材料</Radio>
                  </RadioGroup>
                </div>


                <!-- 文件上传框 有材料专用 -->
                <template v-if="boxObj.youWj==1">
                  <div
                    class="JC_img tran3 pointer textCenter cBlue pullLeft relative overflowH marginR20 marginB20"
                    style="width:120px;"
                  >
                    <!-- 天生缺陷：.zip,.rar 居然能选择office三件套，所以需要二次判断 -->
                    <input
                      type="file"
                      ref="wj"
                      accept=".zip, .rar, .pdf, .docx, .doc"
                      class="InputFileBox"
                      @change="fileXx_up($event)"
                    />
                    <Icon
                      type="ios-add-circle-outline"
                      class="marginB5"
                      style="padding-top:45px;"
                      size="30"
                      v-show="!boxObj.zip_file_path.file_url"
                    />
                    <div class="relative" v-show="boxObj.zip_file_path.file_url">
                      <i class="iconfont f_40 inlineBlock marginT20" :class="$app.fileIcon(boxObj.zip_file_path)"></i>
                      <div class="f_12 c999">{{$app.urlToName(boxObj.zip_file_path)}}</div>
                    </div>
                  </div>
                  <div class="overflowH">
                    <div class="cRed marginB10" >单文件上传，格式限制：pdf / word / zip / rar<br/>材料多文件，请打包成 <span class="f_bold">压缩包</span></div>
                    <template v-if="wg104_107()">
                      <!-- 外观专利 撰写，才显示这个按钮 -->
                      <div>
                        <Button
                          type="primary"
                          shape="circle"
                          icon="md-download"
                          ghost
                          size="small"
                          @click="$app.openWindow('static/word/外观专利图片注意事项.docx')"
                        >外观专利图片注意事项</Button>
                      </div>
                    </template>
                    <template v-else>
                      <div>
                        <Button
                          type="primary"
                          shape="circle"
                          icon="md-download"
                          ghost
                          size="small"
                          @click="$app.openWindow('static/word/专利交底书.zip')"
                        >交底书模板</Button>
                      </div>
                    </template>
                  </div>
                </template>
                
              </Col>
            </Row>
            

            <Row :gutter="15" class="f_14 marginB15">
              <Col :span="6" class="textRight c999 lineH34">备注：</Col>
              <Col :span="15">
                <Input
                  class="tempFW"
                  :placeholder="$app.judgeData(order_id)?'':'请输入备注'"
                  size="large"
                  v-model="remark"
                  ref="remark"
                  clearable
                  :disabled="$app.judgeData(order_id)"
                  type="textarea"
                  :rows="4"
                />
              </Col>
            </Row>
          </template>
          <template v-else>
            <!-- 第5排type 109 110 111 112 113 114 115 116 和 118  ~ 199-->
            <template v-if="gonWcx(boxObj.type)">
              <Row :gutter="15" class="f_14 marginB15">
                <Col :span="6" class="textRight c999 lineH34">
                  <span class="cRed">*</span>
                  专利号：
                </Col>
                <Col :span="15">
                  <Input
                    class="tempFW"
                    :placeholder="$app.judgeData(order_id)?'':'请输入专利号'"
                    size="large"
                    v-model="patent_number"
                    ref="patent_numberXx"
                    clearable
                    :disabled="$app.judgeData(order_id)"
                  />
                </Col>
              </Row>
              <Row :gutter="15" class="f_14 marginB15">
                <Col :span="6" class="textRight c999 lineH34">专利名称：</Col>
                <Col :span="15">
                  <Input
                    class="tempFW"
                    :placeholder="$app.judgeData(order_id)?'':'请输入专利名称'"
                    size="large"
                    v-model="patent_name"
                    clearable
                    :disabled="$app.judgeData(order_id)"
                  />
                </Col>
              </Row>
              <Row :gutter="15" class="f_14 marginB15">
                <Col :span="6" class="textRight c999 lineH34">申请人/专利权人：</Col>
                <Col :span="15">
                  <Input
                    class="tempFW"
                    :placeholder="$app.judgeData(order_id)?'':'请输入申请人/专利权人'"
                    size="large"
                    v-model="applicant_name_list"
                    ref="applicant_name_list"
                    clearable
                    :disabled="$app.judgeData(order_id)"
                  />
                </Col>
              </Row>

              <Row :gutter="15" class="f_14 marginB15">
                <Col :span="6" class="textRight c999 lineH34">备注：</Col>
                <Col :span="15">
                  <Input
                    class="tempFW"
                    :placeholder="$app.judgeData(order_id)?'':'请输入备注'"
                    size="large"
                    v-model="remark"
                    ref="remark"
                    clearable
                    :disabled="$app.judgeData(order_id)"
                    type="textarea"
                    :rows="4"
                  />
                </Col>
              </Row>
            </template>
          </template>
          
        </template>
        <!-- 补差价 -->
        <template v-else>
          <Row :gutter="15" class="f_14 marginB15">
            <Col :span="4" class="textRight c999 lineH34">数量：</Col>
            <Col :span="15">
              <InputNumber
                size="large"
                :min="1"
                :max="9999999999"
                v-model="buXj"
                style="width:150px"
              ></InputNumber>
            </Col>
          </Row>
          <Row :gutter="15" class="f_14 marginB15">
            <Col :span="4" class="textRight c999 lineH34">备注：</Col>
            <Col :span="15">
              <Input
                class="tempFW"
                :placeholder="$app.judgeData(order_id)?'':'请输入备注'"
                size="large"
                v-model="remark"
                ref="remark"
                clearable
                :disabled="$app.judgeData(order_id)"
                type="textarea"
                :rows="4"
              />
            </Col>
          </Row>
        </template>
      </template>
      <!-- type：1商标提交流程；9商标展示详情 -->
      <template v-if="type==2 || type==9">
        <Row :gutter="15" class="f_14 marginB15">
          <Col :span="6" class="textRight c999 lineH34">
            <span class="cRed">*</span>
            商标申请号：
          </Col>
          <Col :span="15">
            <Input
              class="tempFW"
              :placeholder="$app.judgeData(order_id)?'':'请输入商标申请号'"
              size="large"
              v-model="register_number"
              ref="register_numberXx"
              clearable
              :disabled="$app.judgeData(order_id)"
            />
          </Col>
        </Row>
        <Row :gutter="15" class="f_14 marginB15">
          <Col :span="6" class="textRight c999 lineH34">商标名称：</Col>
          <Col :span="15">
            <Input
              class="tempFW"
              :placeholder="$app.judgeData(order_id)?'':'请输入商标名称'"
              size="large"
              v-model="trademark_name"
              ref="trademark_name"
              clearable
              :disabled="$app.judgeData(order_id)"
            />
          </Col>
        </Row>
        <Row :gutter="15" class="f_14 marginB15">
          <Col :span="6" class="textRight c999 lineH34">备注：</Col>
          <Col :span="15">
            <Input
              class="tempFW"
              :placeholder="$app.judgeData(order_id)?'':'请输入备注'"
              size="large"
              v-model="remark"
              ref="remark"
              clearable
              :disabled="$app.judgeData(order_id)"
              type="textarea"
              :rows="4"
            />
          </Col>
        </Row>
      </template>

      <div class="paddingLi overflowH">
        <div class="f_20 pullLeft">
          价格：¥
          <span
            class="cRed f_26 f_bold"
            v-show="boxObj.zhongObj.goods_type!=117"
          >{{$app.judgeData(boxObj.zhongObj)?parseFloat(boxObj.zhongObj.price):0}}</span>
          <span
            class="cRed f_26 f_bold"
            v-show="boxObj.zhongObj.goods_type==117"
          >{{buXj*parseFloat(boxObj.zhongObj.official_fee)}}</span>
          <span class="f_14 marginB15">
            （ 官费：¥
            <span
              class="cRed f_16 f_bold"
            >{{$app.judgeData(boxObj.zhongObj)?parseFloat(boxObj.zhongObj.official_fee):0}}</span> + 服务费：¥
            <span
              class="cRed f_16 f_bold"
            >{{$app.judgeData(boxObj.zhongObj)?parseFloat(boxObj.zhongObj.service_fee):0}}</span> ）
          </span>
        </div>
        <Button
          type="primary"
          class="pullRight"
          size="large"
          @click="liKe"
          :disabled="boxObj.xu==null"
          v-show="!$app.judgeData(order_id)"
        >立即下单</Button>
      </div>
    </Modal>

    <!-- 下单成功支付框 -->
    <PayBox ref="payBox" :noBackBtn="noBackBtn" />

    <Temp119 ref="Temp119" @payBoxGo="payBoxGo" />
  </div>
</template>
<style lang="less" scoped>
@import "./css/temp.less";
</style>
<script>
import PayBox from "@$@/_service/payBox";
import Temp119 from "./temp119";
export default {
  name: "temp",
  components: {
    PayBox,
    Temp119
  },
  data() {
    let data = {
      list: [],

      //两个弹框
      cHBox: false, //公共
      zlNShow: false, //专利缴费单独搞一个，流程更加复杂点
      companyAll: "", //企业信息

      //弹框显示的内容
      boxObj: {
        youWj:0,//有无文件上传 1有材料 0无材料
        title: "",
        list: "",
        zhongObj: {},
        name: "",
        type: "",
        xu: null,
        zip_file_path: {
          //有资料文件上传zip框
          file_name: "",
          file_url: "",
          file_path: ""
        },
        showZipBox: false //显示文件上传框
      },

      //订单ID 用于列表页下单后的付款弹框
      //通过 父级 $refs['Temp'].order_id=xxx，改变这个值，本页面没有直接的赋值改变
      order_id: "",

      buXj: 1 //补差价
    };

    let tool = {
      // 右上角缩减按钮
      suoJ: true,

      //专利类
      patent_name: "",
      patent_number: "",
      applicant_name_list: "",

      //商标类
      trademark_name: "",
      register_number: "",

      //专利+商标+版权 公共用
      remark: "",
      noBackBtn: false
    };

    return Object.assign(data, tool);
  },
  //1专利,2商标,3版权
  props: ["type"],
  created() {
    let { type } = this;
    $ajax.gTypeList(type, resData => {
      this.list = resData;
    });

    $ajax.pInfo(resData => {
      this.companyAll = resData;
    });
  },

  methods: {
    // 104 107 必须为有材料上传，因为是外观专利
    wg104_107(){
      let {
        $route:{
          query:{
            type
          }
        }
      } = this;

      return (type==104 || type==107 || type==131 );
    },
    // 有材料无材料切换
    youWj_Fun(){
      let {
        boxObj:{
          youWj//有无文件上传 1有材料 0无材料
        }
      }=this;

      //初始化资料上传框的内容
      this.boxObj.zip_file_path = {
        file_name: "",
        file_url: "",
        file_path: ""
      };
    },
    // 字数统计
    ziShuJ(){
      let {
        patent_name
      }=this;
      let out='';
      let shu=(patent_name.toString());
      out=shu.length;

      if(out>50){
        return 50;
      }else{
        return out;
      }
    },
    //判断icon样子
    iconWw(i) {
      let out = "";
      switch (parseInt(i)) {
        case 0:
          out = " iconicon-test";
          break;
        case 1:
          out = " icondabao";
          break;
        case 2:
          out = " iconshandianjisu";
          break;
        case 3:
          out = " iconrusuodengji";
          break;
        case 4:
        case 5:
        case 6:
        case 7:
        case 8:
        case 9:
        case 10:
          out = " iconfuwu5";
          break;
      }
      return out;
    },
    iconWv(i) {
      let out = "";
      switch (parseInt(i)) {
        case 0:
          out = " iconmeishuzuopin";
          break;
        case 1:
          out = " iconruanjiankaifabao";
          break;
      }
      return out;
    },
    iconR(i) {
      let out = "";
      switch (parseInt(i)) {
        case 0:
          out = " iconshangbiao";
          break;
        case 1:
          out = " iconshangbiaorenzheng";
          break;
      }
      return out;
    },
    //计算框的最小高度
    wonR() {
      let { type } = this;
      let out = "";
      if (type == 1) {
        //专利
        out = "min-height:680px;";
      } else if (type == 2) {
        //商标
        out = "";
      } else if (type == 3) {
        //版权
        out = "";
      }
      return out;
    },
    payBoxGo(order_id, payFun, noBackBtn) {
      this.noBackBtn = noBackBtn || false;
      $app.payBoxShow(this, order_id, { payFun });
    },
    liKe() {
      //立刻下单
      let that = this;
      let {
        //首次注册的提交：1专利，2商标，3版权
        //除了首次注册外的其他服务：8专利、9商标、10版权
        type,
        boxObj: {
          youWj,//有无文件上传 1有材料 0无材料
          zhongObj: { id: goods_id, goods_type },
          zip_file_path: { file_path: zip_file_path },
          showZipBox //是否 显示上传文件框 
        },
        buXj, //补差价数量
        patent_name,
        patent_number,
        applicant_name_list,
        trademark_name,
        register_number,
        remark
      } = this;
      // console.log(name);
      // console.log(goods_id,patent_name,patent_number,applicant_name_list,remark);

      if (type == 1 || type == 8) {
        //专利 这个type是页面传值

        if (goods_type == 117) {
          //补差价
          $ajax.buyGoodsXx(goods_id, buXj, remark, resData => {
            this.cHBox = false; //关闭弹框
            this.payBoxGo(resData.order_id); //调起支付框
          });
        } else {
          //走流程

          let jA = $app.delSpace(patent_name);
          let jB = $app.delSpace(patent_number);

          // 专利撰写服务：106，107，108

          // 专利后续服务 109~199范围是专利 除了117，因为117是补差价
          let need_patent_number = this.gonWcx(goods_type);

          if (!need_patent_number && !$app.judgeData(jA)) {
            this.$Message.error({ content: "专利名称不能为空" });
            this.$refs["patent_nameXx"].focus();
            this.patent_name = "";
          } else if (need_patent_number && !$app.judgeData(jB)) {
            this.$Message.error({ content: "专利号不能为空" });
            this.$refs["patent_numberXx"].focus();
            this.patent_number = "";
          } else if (showZipBox && this.wg104_107() && !$app.judgeData(zip_file_path)) {//专利后续服务 专利单独费减-专利单独费减（有材料） 必须上传材料
            this.$Message.error({ content: "请上传资料" });
          } else if(youWj==1 &&!$app.judgeData(zip_file_path) ){//用户手贱 点了有材料
            this.$Message.error({ content: "请上传资料" });
          } else {
            $ajax.buyPatentTT({
              goods_id,
              remark,
              patent_name,
              patent_number,
              applicant_name_list,
              zip_file_path
            },resData => {
              this.cHBox = false; //关闭弹框
              this.payBoxGo(resData.order_id); //调起支付框
            },() => {
              this.cHBox = false; //关闭弹框
            });
          }
        }
      } else if (type == 2 || type == 9) {
        //商标
        let jA = $app.delSpace(register_number);
        if (!$app.judgeData(jA)) {
          this.$Message.error({ content: "商标申请号不能为空" });
          this.$refs["register_numberXx"].focus();
          this.register_number = "";
        } else {
          $ajax.buyTmTT(
            {
              goods_id,
              remark,
              trademark_name,
              register_number
            },
            resData => {
              this.cHBox = false; //关闭弹框

              this.payBoxGo(resData.order_id); //调起支付框
            },
            () => {
              this.cHBox = false; //关闭弹框
            }
          );
        }
      } else if (type == 3 || type == 10) {
        $ajax.buyCopyrightZx(goods_id, resData => {
          this.cHBox = false; //关闭弹框

          this.payBoxGo(resData.order_id); //调起支付框
        });
      }
    },
    //子选项卡点击 后 赋值 这个函数
    zTunChange(val, i) {
      // 有 order_id 是详情页过来看详情的
      let { order_id } = this;

      console.log('选中子类',val, i)

      if (!$app.judgeData(order_id)) {
        this.zFun(val, i);
      } else {
        console.log("order_id 有值不给你点击");
      }
    },
    
    zFun(val, i) {
      this.boxObj.xu = i;
      this.boxObj.zhongObj = val;
      this.Pkh();
    },

    //配合上者使用 上传文件筐显示 or 隐藏
    Pkh() {
      let {
        type, //1专利提交 8专利查看
        boxObj:{
          zhongObj:{
            goods_type
          }
        }
      } = this;

      let kuangShow = ($app.is103_108_132(goods_type));

      if (kuangShow && (type == 1 || type == 8)) {
        this.boxObj.showZipBox = true; //显示 文件上传框
        
        // 外观专利相关 必须上传材料
        if(this.wg104_107()){
          this.boxObj.youWj=1;//有无文件上传 1有材料 0无材料
        }

      } else {
        this.boxObj.showZipBox = false; //隐藏 文件上传框

        //初始化资料上传框的内容
        this.boxObj.zip_file_path = {
          file_name: "",
          file_url: "",
          file_path: ""
        };
      }
    },
    //show119支付框
    show119Box(num, buEr) {
      this.$refs["Temp119"].uywY119(num, buEr);
    },
    vPchange(buEr) {
      if (!buEr) {
        //关闭
        setTimeout(() => {
          //初始化弹框的数据
          this.boxObj = {
            youWj:0,//有无文件上传 1有材料 0无材料
            title: "",
            list: "",
            zhongObj: {},
            name: "",
            type: "",
            xu: null,
            zip_file_path: {
              //有资料文件上传zip框
              file_url: "",
              file_path: ""
            },
            showZipBox: false //文件上传框
          };

          (this.order_id = ""), //订单ID 初始化为空
            (this.patent_name = "");
          this.patent_number = "";
          this.applicant_name_list = "";
          this.remark = "";

          this.buXj = 1; //补差价变回1

          //商标类
          this.trademark_name = "";
          this.register_number = "";

          console.log("弹框消失 = ", this.boxObj);
        }, 200);
      } else {
        console.log("弹框的数据 = ", this.boxObj);
      }
    },
    // 第一级选项卡
    away(type, title) {
      let { companyAll } = this;
      // 已经企业实名认证 判断
      // 为什么要经过两层？很肯能会有网络请求的延迟，
      if ($app.judgeData(companyAll) && companyAll.state == 2) {
        //本次请求
        this.opMv(type, title);
      } else if ($app.judgeData($app.getSession("companyAll")) && $app.getSession("companyAll").state == 2 ) {
        //网络延迟，手速比网速快，就请求上一次才存储
        this.opMv(type, title);
      } else {
        $app.confirm("本系统仅供机构使用，请实名后重试", "温馨提示", {
          yesText: "立即认证",
          yesFun: () => {
            $app.companyYes(companyAll); //强制性跳去实名认证
          }
        });
      }
    },

    // 配合上这使用，确定过有权限 下去
    opMv(type, title) {
      let judge = false;
      let name = "";
      let that = this;

      let topTitle = $app.judgeData(title) ? title : "";

      if (type == 119) {
        //119专利续费 无需儿子类
        this.show119Box("", false);
      } else {
        $app.payInline.forEach((val, i) => {
          if (type == val.type) {
            judge = true;
            name = val.name;
          }
        });
        

        let {
          $route: { name: routeName }
        } = that; //获取当前路由的名字

        // 专利： 实用新型+外观+发明 不用图文说明详情页，老板原话
        if (type == 100 || type == 101 || type == 102) {
          // 专利： 实用新型+外观+发明
          // this.goTtPage(type);

          //关闭已有页面 同名字的路由值出现一个
          $app.closeHadPage(name, () => {
            //页面跳转
            this.$router.push({
              name,
              query: { type }
            });
          });
        } else{
          //显示弹框
          that.tonY(topTitle, name, type);
        }
      }
    },
    
    //走下单流程的页面
    goTtPage(type) {
      let name = "";
      // 1专利 2商标 3版权
      let shu = $app.goodsBigClass(type);
      switch (parseInt(shu)) {
        case 1:
          name = "patentDoInfo";
          break;
        case 2:
          name = "trademarkDoInfo";
          break;
        case 3:
          name = "copyrightDoInfo";
          break;
      }

      //关闭已有页面 同名字的路由值出现一个
      $app.closeHadPage(name, () => {
        //页面跳转
        this.$router.push({
          name,
          query: { type }
        });
      });
    },
    //配合上者使用
    tonY(title, name, type) {
      let { order_id } = this;
      if ($app.judgeData(order_id)) {
        //查看详情
        this.tonG(title, name, type);
      } else {
        this.goTtPage(type);
      }
      
      
    },

    //配合上者使用
    tonG(title, name, typeA) {
      this.uywY(title, name, typeA);
      this.Pkh();
    },
    uywY(title, name, typeA) {
      this.cHBox = true; //显示弹框
      this.boxObj.title = title;
      this.boxObj.name = name;
      this.boxObj.type = typeA;
      console.log('到底boxObj = ',this.boxObj)
    },
    //纯粹显示的时候看看
    awayShop(type,title){
      //商品详情请求
      $ajax.gList(type, resData => {
        this.tonX(title, '', type, resData);
      });
    },
    //配合上者使用
    tonX(title, name, typeA, list) {
      this.uywY(title, name, typeA);
      this.boxObj.list = list; //列表赋值
      

      //无论如何，选项卡都默认选中
      this.boxObj.xu = 0;
      this.zFun(this.boxObj.list[0], 0);
      
    },

    // 图文详情页专用
    infoPageBox(title,typeA, list,active){
      
      this.uywY(title,'', typeA);
      this.boxObj.list = list; //列表赋值

      //选项卡都默认选中 第几个
      this.zFun(this.boxObj.list[active], active);
    },

    //zip rar 文件压缩包上传
    fileXx_up(e) {
      let file = e.target.files[0]; //选中的文件

      // 再次格式检验 文件大小限制100mb
      $app.suffix.zipRarWordPdf(e, file,100, () => {
        //1营业执照,2专利文件,3身份证,4外观设计图片,5外观说明文件,6软著文件,7美术著作文件,8商标文件,
        //9商标导入文件-xls,10专利补正文件,11专利oa文件,12专利打包文件(zip/rar),13专利委托书,
        //14企业头像,15商标委托书,16商标注册个体户身份证,17商标注册企业营业执照(pdf),18专利oa时上传对照书(word)
        //19专利导入文件,20商标图片检索
        $ajax.upOther(
          file,
          12,
          (resData, file_name) => {
            this.boxObj.zip_file_path = resData;
            this.boxObj.zip_file_path.file_name = file_name;
            this.$refs["wj"].value = "";
          },
          () => {
            this.$refs["wj"].value = "";
          }
        );
      });
    },

    //专利后续服务.109-118弹框判断 ，踢出117 补差价框，的判断
    gonWcx(shu) {
      let num = parseInt(shu);
      let out = false;
      if (num != 117) {
        if ((109 <= num && num < 130 ) || ( 132 < num && num <= 199) ) {
          out = true;
        }
      }
      return out;
    }
  },
  mounted() {
    //
  }
};
</script>

